Skip to content

test: derive max binary length dynamically from Notecard#233

Closed
zakoverflow wants to merge 1 commit intoblues:masterfrom
zakoverflow:fix/hil-dynamic-max-binary-length
Closed

test: derive max binary length dynamically from Notecard#233
zakoverflow wants to merge 1 commit intoblues:masterfrom
zakoverflow:fix/hil-dynamic-max-binary-length

Conversation

@zakoverflow
Copy link
Copy Markdown
Contributor

Problem

The test_get_max_binary_length HIL test was asserting that the Notecard's reported card.binary max matched a hardcoded per-target constant (R5_MAX_BINARY_LENGTH=130554, U5_MAX_BINARY_LENGTH=261110). This caused the test to fail whenever a nightly Notecard firmware update changed the reported max (e.g. 261110 → 261114 on 2026-02-02), even though the SDK and Notecard were both functioning correctly.

As a result, the workflow_dispatch trigger (on-demand run) was effectively broken — triggering the tests manually would fail not because of any SDK bug, but because of a stale expected value.

Fix

Remove the hardcoded constants and the get_expected_max_binary_length() helper. The Notecard firmware is the authoritative source of truth for the maximum binary buffer size.

The downstream tests that follow test_get_max_binary_length already use the runtime-queried max_binary_length value, so no regression coverage is lost. The minimum sanity check (max >= 1024) is retained.

Impact

  • The notecard-binary-tests workflow can now be triggered on demand (workflow_dispatch) and run against any Notecard firmware without pre-updating hardcoded constants.
  • No changes to note-c library code — test-only change.

Remove the hardcoded per-target constants (R5_MAX_BINARY_LENGTH=130554,
U5_MAX_BINARY_LENGTH=261110) and the get_expected_max_binary_length()
helper that compared them against card.binary "max".

The assertion against a hardcoded value caused test_get_max_binary_length
to fail whenever the nightly Notecard firmware changed the reported max
(e.g. 261110 -> 261114 on 2026-02-02), even though the SDK and the
Notecard were both functioning correctly.

The Notecard firmware is the authoritative source of truth for the
maximum binary buffer size. Tests that follow test_get_max_binary_length
already use the runtime-queried max_binary_length value; the equality
assertion added no regression protection beyond what those downstream
tests already provide.

The minimum sanity check (max >= 1024) is retained.
@zakoverflow
Copy link
Copy Markdown
Contributor Author

Closing — the workflow_dispatch trigger already exists. Opening this PR was a misread of the request.

@zakoverflow zakoverflow closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant